VERSION 5.00 Begin VB.Form frmStatusBar AutoRedraw = -1 'True Caption = "VB API created Status Bar with Progress Bar" ClientHeight = 2070 ClientLeft = 3435 ClientTop = 4290 ClientWidth = 8100 LinkTopic = "Form3" MaxButton = 0 'False NegotiateMenus = 0 'False ScaleHeight = 2070 ScaleWidth = 8100 Tag = "0" Begin VB.CommandButton TabStp Height = 405 Left = -870 TabIndex = 0 Top = 2700 Width = 810 End Begin VB.CommandButton Command1 Caption = "Create Progress Bar in Pane 4" Height = 360 Left = 225 TabIndex = 2 Top = 1155 Width = 2415 End Begin VB.Timer Timer1 Interval = 1000 Left = 7890 Top = 90 End Begin VB.Label Label1 BackStyle = 0 'Transparent Caption = $"frmStatusBar.frx":0000 BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 930 Left = 180 TabIndex = 1 Top = 315 Width = 7620 WordWrap = -1 'True End Attribute VB_Name = "frmStatusBar" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private zStatBar As New CStatusBar32x Private Const WM_DRAWITEM = &H2B Private ProgBarActive As Boolean Private Type PaneInfo Panes(4) As String PaneAlignment(4) As sbAlignment TextColor(4) As SystemColorConstants textoffset(4) As Integer End Type Public Sub UpDateStat() zStatBar.DrawTextPic 0, Format(Time, "hh:mm:ss AMPM"), 0, CENTER, vbBlue, , 14 zStatBar.DrawTextPic 1, "Pane - 1", 22, CENTER, , True zStatBar.DrawTextPic 2, "Pane - 2", 10, Left, vbRed, True, 22 zStatBar.DrawTextPic 3, "Pane - 3", 20, Left, vbBlue, , 22 zStatBar.DrawTextPic 4, Format(Date, "DD-MMMM-YY"), 30, CENTER, , True End Sub Private Sub Command1_Click() Dim zProgBar As New CProgBar32 Dim PaneRect As RECT 'Get Pane 4s dimensions Call SendMessage(zStatBar.GetStatBarHwnd, SB_GETRECT, 4, PaneRect) With zProgBar 'Set hwnd as a parent instead of an object .SethWndParent = zStatBar.GetStatBarHwnd 'Create Progress Bar in the 4 Pane of StatusBar (0 based) .Create PaneRect.Left, PaneRect.Top, PaneRect.Right - PaneRect.Left + 15, PaneRect.Bottom - PaneRect.Top End With Dim zStepProgBar As Integer 'Step Progress Bar For zStepProgBar = 0 To 100 Step 2 zProgBar.SetProgBarPos zStepProgBar 'Put as slight Delay in there zProgBar.DelayProgBar 2 'Destroy Progress Bar zProgBar.DestroyProgBar 'Make sure Pane 4 is drawn when we are done UpDateStat End Sub Private Sub Form_Load() 'Written by Ramon Guerrero for 'Hardcore Visual Basic 5.0 'ZoneCorp@dallas.net 'ZoneCorp@Aol.com 'ZoneCOrp@Compuserve.com With zStatBar Set .Parent = Me .Create End With 'Get the Icons for the Status bar zStatBar.SetIcon 0, 0 zStatBar.SetIcon 1, 1 zStatBar.SetIcon 2, 2 zStatBar.SetIcon 3, 3 zStatBar.SetIcon 4, 4 'SubClass Form SubClass Me.hwnd End Sub Private Sub UnSubClass() Dim hWndCur As Long hWndCur = Me.hwnd If NextProcs Then SetWindowLong hWndCur, GWL_WNDPROC, NextProcs NextProcs = 0 End If End Sub Private Sub SubClass(hwnd As Long) On Error Resume Next NextProcs = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc) End Sub Public Sub Form_Resize() zStatBar.Resize End Sub Public Sub ProcMsg(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, result As Long) On Error Resume Next Select Case uMsg 'we need to catch this message so we can update the status bar Case WM_DRAWITEM 'Don't pass it on Nodef = False 'Redraw text and icons UpDateStat End Select End Sub Private Sub Form_Unload(Cancel As Integer) UnSubClass zStatBar.DestroyStatBar End Sub Private Sub Timer1_Timer() zStatBar.DrawTextPic 0, Format(Time, "hh:mm:ss AMPM"), 0, CENTER, vbBlue, , 14 End Sub